function [] = pp_baugh_wooley_tb()
    A = [1 1 1];
    B = [0 0 1];
    C = [0 1 1];
    X = [   0     0     0     1     1     0     1
            0     0     1     1     0     1     0
            0     1     1     0     1     0     0
            0     0     1     0     0     0     0];
    Z = pp_baugh_wooley(A,B,C);
    assert2(A,B,Z,X, 1, 32);

    A = [1 0 1 0];
    B = [1 1 1 1];
    X = [   0     0     0     1     0     0     0
            1     1     0     1     1     1     0
            0     1     0     0     0     0     0
            1     0     0     0     0     0     0];
    Z = pp_baugh_wooley(A,B);
    assert2(A,B,Z,X, 1, 32);
end


function [] = assert(A, B,Z,X)
    if(X == Z)
        fprintf('\tJa: %s*%s => %s\n',mat2str(A),mat2str(B),mat2str(Z));
    else
        fprintf('\tNej: %s*%s => %s (%s)\n',mat2str(A),mat2str(B),mat2str(Z),mat2str(X));       
    end
end

function [] = assert2(A, B,Z,X, s1,s)
    if(X == Z)
        fprintf('\tYes: %s*%s =>',mat2str(A),mat2str(B));
        print_matrix(Z, s1, s);
    else
        fprintf('\tNo : %s*%s =>',mat2str(A),mat2str(B));
        print_matrix(Z, s1, s);
        
        pad(s-12);
        fprintf('Correct is:');
        print_matrix(X, s1, s);
    end
end

function [] = print_matrix(G,s1,s)
    [height, length] = size(G);
    pad(s1);
    fprintf('[');
    for i = 1:height,
        if(i ~= 1)
            pad(s);
            fprintf(' ');
        end
        for j = 1:length,
            if(i == 1)
                %fprintf(' ');
            elseif(j == length)
            else
            end
              %  fprintf(' ');
            fprintf('%d', G(i,j));
            if(j ~= length)
                fprintf(' ');
            end
        end
        if(i ~= height)
            fprintf('\n');
        end
    end
    fprintf(']\n');
end

function [] = pad(n)
    for i = 1:n,
        fprintf(' ');
    end
end